﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace ICeFramework.Win.UI.Internal
{
    internal class NativeMethods
    {
        internal class Util
        {
            // Methods
            public static int HIWORD(int n)
            {
                return ((n >> 0x10) & 0xffff);
            }

            public static int LOWORD(int n)
            {
                return (n & 0xffff);
            }

            [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
            private static extern int lstrlen(string s);
            public static int MAKELONG(int low, int high)
            {
                return ((high << 0x10) | (low & 0xffff));
            }

            public static int MAKELPARAM(int low, int high)
            {
                return ((high << 0x10) | (low & 0xffff));
            }

            [DllImport("user32.dll", CharSet = CharSet.Auto)]
            internal static extern int RegisterWindowMessage(string msg);
            public static int SignedHIWORD(int n)
            {
                int num = (short)((n >> 0x10) & 0xffff);
                num = num << 0x10;
                return (num >> 0x10);
            }

            public static int SignedHIWORD(IntPtr n)
            {
                return SignedHIWORD((int)((long)n));
            }

            public static int SignedLOWORD(int n)
            {
                int num = (short)(n & 0xffff);
                num = num << 0x10;
                return (num >> 0x10);
            }

            public static int SignedLOWORD(IntPtr n)
            {
                return SignedLOWORD((int)((long)n));
            }
        }
    }
}
